<?php
error_reporting(0);
define('IN_CRONLITE', true);
define('IN_OTHER', true);
define('CACHE_FILE', 0);
define('SYSTEM_ROOT', dirname(__FILE__) . '/');
define('ROOT', dirname(SYSTEM_ROOT) . '/');
date_default_timezone_set('Asia/Shanghai');
$date = date("Y-m-d H:i:s");

if (is_file(ROOT . 'includes/360safe/360webscan.php')) {
    require_once ROOT . 'includes/360safe/360webscan.php';
}

$scriptpath = str_replace('\\', '/', $_SERVER['SCRIPT_NAME']);
$sitepath = substr($scriptpath, 0, strrpos($scriptpath, '/'));
$siteurl = ($_SERVER['SERVER_PORT'] == '443' ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $sitepath . '/';

if (!isset($_SERVER['HTTP_USER_AGENT']) || !strpos($_SERVER['HTTP_USER_AGENT'], chr(46))) {
    $_SERVER['HTTP_USER_AGENT'] = 'Mozilla/5.0 (Windows NT 10.0) Safari/537.36';
}

require ROOT . 'includes/config.php';
//连接数据库
require_once ROOT . 'includes/lib/PdoHelper.php';
$DB = new PdoHelper($dbconfig);
require_once ROOT . 'includes/lib/Cache.php';
$CACHE = new Cache();
$conf = $CACHE->pre_fetch();
define('SYS_KEY', $conf['syskey']);

include ROOT . 'includes/function.php';

include ROOT . 'includes/authcode.php';

if ($conf['cdn_public'] == 1) {
    $cdnpublic = '//cdn.staticfile.org/';
} elseif ($conf['cdn_public'] == 2) {
    $cdnpublic = '//cdn.bootcss.com/';
} elseif ($conf['cdn_public'] == 3) {
    $cdnpublic = '//cdnjs.cloudflare.com/ajax/libs/';
} else {
    $cdnpublic = '//lib.baomitu.com/';
}
if (!empty($conf['cdn_private'])) {
    $cdnprivate = '//' . $conf['cdn_private'] . '/';
} else {
    $cdnprivate = null;
}

$clientip = real_ip($conf['function_ip']);

function showalert($msg, $status)
{
    if ($status == 1) {
        $link = '../user/';
    } else {
        $link = '../user/#/pay';
    }

    echo '<meta charset="utf-8"/><script>alert("' . $msg . '");window.location.href="' . $link . '";</script>';
}
